<!doctype html>
<html lang="en">

<head>
	<!-- Required meta tags -->
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!--favicon-->
	
	<!--plugins-->
	<link href="css/simplebar.css" rel="stylesheet">
	<link href="css/perfect-scrollbar.css" rel="stylesheet">
	<link href="css/metisMenu.min.css" rel="stylesheet">
	<!-- loader-->
	<link href="css/pace.min.css" rel="stylesheet">
	<script src="js/pace.min.js"></script>
	<!-- Bootstrap CSS -->
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<link href="css/css2.css" rel="stylesheet">
	<link href="css/app.css" rel="stylesheet">
	<link href="css/icons.css" rel="stylesheet">
	<title>榆园财务管理系统</title>
</head>

<body class="bg-login">
	<!--wrapper-->
	<div class="wrapper">
		<div class="section-authentication-signin d-flex align-items-center justify-content-center my-5 my-lg-0">
			<div class="container-fluid">
				<div class="row row-cols-1 row-cols-lg-2 row-cols-xl-3">
					<div class="col mx-auto">
<!--						<div class="mb-4 text-center">-->
<!--							<img src="picture/logo-img.png" width="180" alt="">-->
<!--						</div>-->
						<div class="card">
							<div class="card-body">
								<div class="border p-4 rounded">
									<div class="text-center">
										<h3 class="">榆园财务管理系统</h3>
										<p></p>
										<p>测试账号：22，测试密码：22</p>
										</p>
									</div>
									<div class="login-separater text-center mb-4"> <span>使用账号密码登录</span>
										<hr>
									</div>
									<div class="form-body">
										<form class="row g-3">
											<div class="col-12">
<!--												<label for="inputAccountNumber" class="form-label">账号</label>-->
												<input type="text" class="form-control" id="code" placeholder="账号">
											</div>
											<div class="col-12">
<!--												<label for="inputChoosePassword" class="form-label">密码</label>-->
												<div class="input-group" id="show_hide_password">
													<input type="password" class="form-control border-end-0" id="password" value="" placeholder="密码"> <a href="javascript:;" class="input-group-text bg-transparent"><i class='bx bx-hide'></i></a>
												</div>
											</div>
											<div class="col-md-6">
												<div class="form-check form-switch">
													<input class="form-check-input" type="checkbox" id="flexSwitchCheckChecked" checked="">
													<label class="form-check-label" for="flexSwitchCheckChecked">记住我</label>
												</div>
											</div>
											<div class="col-md-6 text-end">	<a href="error/errors-coming-soon.html">忘记密码?</a>
											</div>
											<div class="col-12">
												<div class="d-grid">
													<button type="button" class="btn btn-primary" onclick="login()"><i class="bx bxs-lock-open"></i>登录</button>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--end row-->
			</div>
		</div>
	</div>
	<!--end wrapper-->
	<!-- Bootstrap JS -->
	<script src="js/bootstrap.bundle.min.js"></script>
	<!--plugins-->
	<script src="js/jquery.min.js"></script>
	<script src="js/simplebar.min.js"></script>
	<script src="js/metisMenu.min.js"></script>
	<script src="js/perfect-scrollbar.js"></script>
	<!--Password show & hide js -->
	<script>
		function login(){
			var code = $("#code").val();
			var password = $("#password").val();
			if(code == "" || password == ""){
				alert("用户名或密码不能为空");
			}else {
				$.ajax({
					type:"post",
					url:"user/login",
					data:{
						code:code,
						password:password
					},
					success:function (data){
						if(data.data){
							window.location = "/";
						}else {
							alert("用户名或密码错误");
						}
					},
					error:function (){
						alert("error");
					}
				})
			}
		}

		$(document).ready(function () {
			$("#show_hide_password a").on('click', function (event) {
				event.preventDefault();
				if ($('#show_hide_password input').attr("type") == "text") {
					$('#show_hide_password input').attr('type', 'password');
					$('#show_hide_password i').addClass("bx-hide");
					$('#show_hide_password i').removeClass("bx-show");
				} else if ($('#show_hide_password input').attr("type") == "password") {
					$('#show_hide_password input').attr('type', 'text');
					$('#show_hide_password i').removeClass("bx-hide");
					$('#show_hide_password i').addClass("bx-show");
				}
			});
		});
	</script>
	<!--app JS-->
	<script src="js/app.js"></script>
</body>
</html>